package com.isnmp.nms.framework.discover.rstype;

import com.isnmp.common.snmp.impl.SNMPUtils;
import com.isnmp.common.snmp.mib.MibIfEntry;
import com.isnmp.nms.framework.discover.ResourceInfo;

public class InterfaceType extends SNMPTableBasicMothType {
    public InterfaceType() {
        setResoureTypeName(Messages.getString("InterfaceType.0"));
    }

    public Class getORMappingClass() {
        return MibIfEntry.class;
    }

    public String getResourceSearchMoth() {
        return Messages.getString("InterfaceType.1");
    }

    public ResourceInfo tableMibInfoToResouce(Object paramObject) {
        ResourceInfo localResourceInfo = new ResourceInfo();
        MibIfEntry ifEntry = (MibIfEntry) paramObject;
        if ((ifEntry.getIfIndex() == 0) || (ifEntry.getIfDescr() == null) || (ifEntry.getIfDescr().equals("")))
            return null;

        System.out.println(ifEntry.toString());
        String str1 = ifEntry.getIfDescr();
        String str2 = Messages.getString("InterfaceType.3") + ifEntry.getIfIndex();
        localResourceInfo.setResourceRSIDValue(ifEntry.getIfIndex() + "");
        localResourceInfo.setResourceName(str1);
        localResourceInfo.setResourceParam(SNMPUtils.formatDispayMacAddress(ifEntry.getIfPhysAddress()));
        localResourceInfo.setResourceDesc(str2);
        localResourceInfo.setResrouceRemarks(Messages.getString("InterfaceType.5") + ifEntry.getIfSpeed() / 1000000L + "Mbps");
        return localResourceInfo;
    }
}